package com.wang.lottery.domain.strategy.service.draw;

import com.wang.lottery.domain.strategy.service.algorithm.IDrawAlgorithm;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author wjh
 * @create 2023-11-01 14:41
 * 抽奖配置信息，包含抽奖策略
 */
public class DrawConfig {
    //注入抽奖算法bean，构造后存入map
    @Resource
    private IDrawAlgorithm defaultRateRandomDrawAlgorithm;
    @Resource
    private IDrawAlgorithm singleRateRandomDrawAlgorithm;
    
    protected Map<Integer,IDrawAlgorithm> drawAlgorithmMap = new ConcurrentHashMap<>();
    
    @PostConstruct
    public void init() {
        drawAlgorithmMap.put(1,singleRateRandomDrawAlgorithm);
        drawAlgorithmMap.put(2,defaultRateRandomDrawAlgorithm);
    }
}
